/<template>
  <div class="list">
    <ul>
      <li 
      v-for="(item,index) in list" 
      :key="item.id"
      @click="activeIndex=index"
      :class="{on:activeIndex==index}"
      >{{ item.name }}</li>
    </ul>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      list: [],
      activeIndex:0,
    };
  },
  mounted() {
    axios.get("/list").then((res) => {
      console.log(res.data);
      this.list = res.data;
    });
  },
};
</script>

<style lang='scss'>
.list{
    width: 100%;
    height: 60px;
    overflow-x: scroll;
    ul{
        width: 1000px;
        height: 100%;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    .on{
        color: orangered;
        font-weight: bold;
        border-bottom: 1px solid #333;
    }
}
</style>